package online.heycm.platform.oss;

import lombok.Getter;
import online.heycm.platform.common.entity.exception.BizException;

/**
 * OSS 厂商
 */
@Getter
public enum OssType {
    // aws
    AWS("aws"),

    // 七牛云
    QINIU("qiniu"),

    // minio
    MINIO("minio"),

    // 腾讯云
    TENCENT("tencent"),

    // 阿里云
    ALIYUN("aliyun");

    private final String type;

    OssType(String type) {
        this.type = type;
    }

    public static OssType of(String type) {
        for (OssType value : OssType.values()) {
            if (value.getType().equalsIgnoreCase(type)) {
                return value;
            }
        }
        throw new BizException("不支持的OSS厂商: " + type);
    }
}
